#! /usr/bin/env python
# -*- coding: utf-8 -*-
import rospy

from std_msgs.msg import String

if __name__ == "__main__":
    #initialize ROS node
    rospy.init_node("publisher")

    #create a publisher, and config topic name,topic type, and queue_size
    pub = rospy.Publisher("topic1",String,queue_size=100)
    # pub2 = rospy.Publisher("topic2",String,queue_size=100)


    #msg contents the message we want to deliver

    #create msg
    msg = String()  


    #set frequency 1 Hz
    rate = rospy.Rate(1)

    #set a counter
    count = 0   

    # rospy.sleep(2)
    #while the python file is still running
    while not rospy.is_shutdown():

        #edit the content of msg
        msg.data = "helloword: " + str(count)

        #publisher publish topic1, which contents msg
        pub.publish(msg)
        # pub2.publish(msg)


        #frequency controller
        rate.sleep()

        #output log file
        rospy.loginfo("msg contents: %s",msg.data)

        count += 1